JsBlobRandomAccessSource
JavaScript/Browser implementation of RandomAccessSource using Blob API.
Uses Blob.slice() for efficient random access to file data without loading the entire file into memory.
Important: Browser Blob operations are inherently asynchronous. This implementation pre-loads metadata section during open for synchronous access via readAt, and provides readAtAsync for accessing data beyond the preloaded buffer.
Usage:
// From file input
val file: File = document.getElementById("fileInput").files[0]
val source = JsBlobRandomAccessSource.open(file)
// Sync access for metadata (within preloaded buffer)
val header = source.readAt(0, 24)
// Async access for tensor data
val tensorData = source.readAtAsync(tensorOffset, tensorSize)Content copied to clipboard